REP1=1
REP2=2
running=False
while not running:
    rep = int(input("是否继续：输入1or2,1继续，2退出"))
    if rep==REP1:
        sw = "日一二三四五六"
        y = int(input("请输入年份："))
        m = int(input("请输入月份："))
        if 0<m<=12:
            d = int(input("请输入日期："))
            if 0<d<=31:
                print(y, '年', m, '月', d, '日')
                week = (d + 2 * m + 3 * (m + 1) // 5 + y + y // 4 - y // 100 + y // 400 + 1) % 7
                weekday = sw[week]
                print('星期', weekday)
                running = False
            else:
                print("错误")
        else:
            print("错误")
    elif rep==REP2:
        print("bye")
        exit()
